package cn.itcast.security;

import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 认证成功的处理
 **/
public class MyAuthenticationSuccessHandler implements AuthenticationSuccessHandler {
    
        @Override
        public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
            response.setContentType("application/json;charset=utf-8");
            response.setStatus(200);
            response.getWriter().println("登录成功!");
//            RespBean respBean = RespBean.ok("登录成功!", HrUtils.getCurrentHr());
//            new GalenWebMvcWrite().writeToWeb(response, respBean);
            System.out.println("登录成功!");
        }
    }
